package com.project.lk.nurseapp.doctor.presenter;

import com.project.lk.nurseapp.base.BaseApi;
import com.project.lk.nurseapp.base.BasePresenter;
import com.project.lk.nurseapp.base.ModelPresenterBridge;
import com.project.lk.nurseapp.doctor.model.DoctorItemBean;
import com.project.lk.nurseapp.doctor.model.DoctorModel;
import com.project.lk.nurseapp.nurse.model.ChatListItemBean;

import java.util.List;

/**
 * 功能介绍：
 * 项目名：
 * 模块名称：
 * 作者：LK
 * 日期：2018/1/9
 * 修改日期：
 */
public class DoctorPresenter extends BasePresenter<IDoctorView> implements ModelPresenterBridge {

    DoctorModel doctorModel;

    public DoctorPresenter(IDoctorView view){
        doctorModel=new DoctorModel();
        doctorModel.setBridge(this);
        addView(view);
    }


    public void refresh(String url,String sessionId){
        doctorModel.refresh();
        doctorModel.postLoadJson(url,sessionId);

    }

    public void loadMore(String url,String sessionId){
        doctorModel.loadMore();
        doctorModel.postLoadJson(url,sessionId);
    }
    public List<DoctorItemBean> getList(){
        return doctorModel.getmList();
    }
    @Override
    public void bridge(int action, List list) {
        if (view!=null) {
            switch (action){
                case BaseApi.show_list:
                    view.showList();
                    break;
                case BaseApi.noMore:
                    view.noMore();
                    break;
                case BaseApi.fail:
                    view.fail();
                    break;
            }
        }
    }
}
